package org.nf.ssm.service.impl;

import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.nf.ssm.dao.BookDao;
import org.nf.ssm.domain.Book;
import org.nf.ssm.service.BookService;
import org.nf.ssm.web.vo.TypeVO;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author zhu
 * @date 2024-10-17
 */
@Service("bookService")
@RequiredArgsConstructor
public class BookServiceImpl implements BookService {

    private final BookDao bookDao;

    @Override
    public PageInfo<Book> getAllBook(Integer pageNum, Integer pageSize) {
        return new PageInfo<>(bookDao.getAllBook(pageNum, pageSize));
    }

    @Override
    public void addBook(Book book) {
        bookDao.addBook(book);
    }

    @Override
    public void updateBook(Book book) {
        bookDao.updateBook(book);
    }

    @Override
    public void deleteBook(Integer bookId) {
        bookDao.deleteBook(bookId);
    }

    @Override
    public List<TypeVO> getTypeList() {
        return bookDao.getTypeList();
    }
}
